picoRequest is package{
  
  -- test requests with and without write back 
  listener has type actor of{
    msg has type stream of ((string,integer));
    report has type ()=>relation of ((string,integer));
    clearHistory has type action();
  }
  listener is actor{
    on Ev on msg do append(Ev);
    
    report()is txs;
    
    clearHistory() do clear();
  } using {
    var txs := relation{};
    append(Ev) do extend txs with Ev;
    clear() do txs := relation{};
  };
  
  events is relation of {all ("event number $Ix",Ix) where Ix in (iota(1,10,1) has type array of integer)}; 
 
  showHistory() do
  {
    H is query listener's report with report();
    logMsg(info,"history has $(size(H)) elements");
  } 
  
  main() do {
    for count in iota(0,100,1) do{
      request listener's clearHistory to clearHistory();
      
      for Ev in events do{
        notify listener with Ev on msg;
      };
    
      -- sleep(100L);
    
      showHistory();
      listenerHistory is query listener's report with report();
    
      assert listenerHistory=events;
    }
  }
}
     